<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
	<title>Title</title>
	<link rel="stylesheet" href="../layui/css/layui.css" media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/my_css/my_login_css.css" >
	<script src="../layui/layui.js"></script>
	<script src="${pageContext.request.contextPath}/page/js/jquery.min.js"></script>

</head>
<body>
<input type="hidden" id="flag_manager" value=<%=session.getAttribute("flag_manager")%> />

<div class="login_style">
	<div class="login_style_title">
		<strong><label style="font-size: 20px;" onclick="test1()">管理员登录</label></strong>
	</div>
	<div class="login_style_form">
		<div class="login_style_form_input_text">用户名： <input id="manager_name" type="text" class="input_style" placeholder="请输入管理员名字" /><br></div>
		<div class="login_style_form_input_password">密码：   <input id="manager_password" type="password" class="input_style" placeholder="请输入密码" /></div>
	</div>
	<div class="login_style_btn" onclick="manager_login()">
		<label>登录</label>
	</div>
</div>

<script>
	var layer;
	layui.use('form', function(){
		var form = layui.form;

	});
	layui.use('layer', function(){
		layer = layui.layer;

	});
	function manager_login(){
		var manager_name=$("#manager_name").val();
		var manager_password=$("#manager_password").val();
		if(manager_name==""){
			layer.msg("管理员名字不能为空");
			return ;
		}
		if(manager_password==""){
			layer.msg("密码不能为空");
			return ;
		}
		$.ajax({
			url:"${pageContext.request.contextPath}/other/manager_login.do",
			data:{
				"manager_name":manager_name,
				"manager_password":manager_password
			},
			success:function(data,status){
				if(status=="success"){
					if(data==1){
						layer.msg("不存在该管理员");
						return ;
					}
					if(data==2){
						layer.msg("密码错误");
						return ;
					}
					window.location.href="main.jsp"
				}
			}
		})
	}
	function test1(){
		if($("#flag_manager").val()=="null")
		  layer.alert($("#flag_manager").val());
		else
			layer.alert($("#flag_manager").val());
	}
</script>
</body>
</html>
